class AdjustInvoiceBean {
  List<AdjustInvoiceData>? data;
  String? msg;
  int? status;

  AdjustInvoiceBean({this.data, this.msg, this.status});

  AdjustInvoiceBean.fromJson(Map<String, dynamic> json) {
    if (json['data'] != null) {
      data = <AdjustInvoiceData>[];
      json['data'].forEach((v) {
        data!.add(new AdjustInvoiceData.fromJson(v));
      });
    }
    msg = json['msg'];
    status = json['status'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.data != null) {
      data['data'] = this.data!.map((v) => v.toJson()).toList();
    }
    data['msg'] = this.msg;
    data['status'] = this.status;
    return data;
  }
}

class AdjustInvoiceData {
  String? bCCODE;
  String? bCNAME;
  String? bILLCODE;
  String? cMCODE;
  String? cMSERVICENAME;
  String? cREATEDATE;
  String? gUID;
  String? iMONTH;
  String? iYEAR;
  String? mODIFIER;
  String? mODIFIERCODE;
  String? mODIFYREMARK;
  dynamic nOWMONEY;
  dynamic oLDMONEY;
  String? rEVIEWER;
  int? rEVIEWERFLAG;
  String? rEVIEWERFLAGSTATE;
  String? rEVIEWERCODE;
  String? rEVIEWERDATE;
  String? tYPE;
  dynamic adjustedAmount;

  AdjustInvoiceData(
      {this.bCCODE,
        this.bCNAME,
        this.bILLCODE,
        this.cMCODE,
        this.cMSERVICENAME,
        this.cREATEDATE,
        this.gUID,
        this.iMONTH,
        this.iYEAR,
        this.mODIFIER,
        this.mODIFIERCODE,
        this.mODIFYREMARK,
        this.nOWMONEY,
        this.oLDMONEY,
        this.rEVIEWER,
        this.rEVIEWERFLAG,
        this.rEVIEWERFLAGSTATE,
        this.rEVIEWERCODE,
        this.rEVIEWERDATE,
        this.tYPE});

  AdjustInvoiceData.fromJson(Map<String, dynamic> json) {
    bCCODE = json['BC_CODE'];
    bCNAME = json['BC_NAME'];
    bILLCODE = json['BILL_CODE'];
    cMCODE = json['CM_CODE'];
    cMSERVICENAME = json['CM_SERVICENAME'];
    DateTime createDate =  DateTime.fromMillisecondsSinceEpoch(json['CREATE_DATE']);
    String createStr = "${createDate.year}-${createDate.month.toString().padLeft(2, '0')}-${createDate.day.toString().padLeft(2, '0')}";
    cREATEDATE = createStr;

    gUID = json['GUID'];
    iMONTH = json['I_MONTH']; // 如果为空，则把申请时间的月份赋值
    if(iMONTH == null ){
      DateTime applyDate =  DateTime.fromMillisecondsSinceEpoch(json['CREATE_DATE']);
      iMONTH = applyDate.month.toString().padLeft(2, '0');
    }
    iYEAR = json['I_YEAR']; // 如果为空，则把申请时间的年份赋值
    if(iYEAR == null ){
      DateTime applyDate =  DateTime.fromMillisecondsSinceEpoch(json['CREATE_DATE']);
      iYEAR = applyDate.year.toString();
    }

    mODIFIER = json['MODIFIER'];
    mODIFIERCODE = json['MODIFIER_CODE'];
    mODIFYREMARK = json['MODIFY_REMARK'];
    nOWMONEY = json['NOWMONEY'];
    oLDMONEY = json['OLDMONEY'];
    rEVIEWER = json['REVIEWER'];
    rEVIEWERFLAG = json['REVIEWERFLAG'];
    rEVIEWERFLAGSTATE = json['REVIEWERFLAG_STATE'];
    rEVIEWERCODE = json['REVIEWER_CODE'];
    rEVIEWERDATE="";
    if(json['REVIEWER_DATE']!= null){
    DateTime reviewerDate =  DateTime.fromMillisecondsSinceEpoch(json['REVIEWER_DATE']);
    String reviewerStr = "${reviewerDate.year}-${reviewerDate.month.toString().padLeft(2, '0')}-${reviewerDate.day.toString().padLeft(2, '0')}";
    rEVIEWERDATE = reviewerStr;
    }
    tYPE = json['TYPE'];
    adjustedAmount = (nOWMONEY??0) + (oLDMONEY??0);
  }


  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['BC_CODE'] = this.bCCODE;
    data['BC_NAME'] = this.bCNAME;
    data['BILL_CODE'] = this.bILLCODE;
    data['CM_CODE'] = this.cMCODE;
    data['CM_SERVICENAME'] = this.cMSERVICENAME;
    data['CREATE_DATE'] = this.cREATEDATE;
    data['GUID'] = this.gUID;
    data['I_MONTH'] = this.iMONTH;
    data['I_YEAR'] = this.iYEAR;
    data['MODIFIER'] = this.mODIFIER;
    data['MODIFIER_CODE'] = this.mODIFIERCODE;
    data['MODIFY_REMARK'] = this.mODIFYREMARK;
    data['NOWMONEY'] = this.nOWMONEY;
    data['OLDMONEY'] = this.oLDMONEY;
    data['REVIEWER'] = this.rEVIEWER;
    data['REVIEWERFLAG'] = this.rEVIEWERFLAG;
    data['REVIEWERFLAG_STATE'] = this.rEVIEWERFLAGSTATE;
    data['REVIEWER_CODE'] = this.rEVIEWERCODE;
    data['REVIEWER_DATE'] = this.rEVIEWERDATE;
    data['TYPE'] = this.tYPE;
    data['adjustedAmount'] = this.adjustedAmount;
    return data;
  }
}
